package ch.pizzapp.kurier;

import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Extra;

import ch.pizzapp.kurier.data.ResponceData;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;

@EActivity(R.layout.activity_sign_up)
public class SignUpActivity extends Activity {
	
	@Extra("ResponceData")
	ResponceData responceData;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sign_up);

		if (savedInstanceState == null) {
			getFragmentManager().beginTransaction()
					.add(R.id.container, SignUpFragment.newInstance(responceData)).commit();
		}
		getActionBar().setDisplayHomeAsUpEnabled(true);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.sign_up, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			NavUtils.navigateUpFromSameTask(this);
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

}
